<?php

namespace app\controller\admin;

use app\BaseController;
use app\model\Plateform;
use app\model\PlateformCode;
use think\response\Json;

class Supplier extends BaseController
{
    public function page(): Json
    {
        return $this->success($this->app->make(Plateform::class)->pageData());
    }
    public function save(): Json
    {
        if(!$this->request->isPost()) throw new \Exception("请求方式错误", 7001);
        return $this->success($this->app->make(Plateform::class)->saveData());
    }

    public function detail(): Json
    {
        return $this->success($this->app->make(Plateform::class)->detail());
    }

    public function codePage(): Json
    {
        return $this->success($this->app->make(PlateformCode::class)->codePage());
    }

    public function addCode(): Json
    {
        if(!$this->request->isPost()) throw new \Exception("请求方式错误", 7001);
        return $this->success($this->app->make(PlateformCode::class)->addCode());
    }

    public function destroy(): Json
    {
        if(!$this->request->isPost()) throw new \Exception("请求方式错误", 7001);
        return $this->success($this->app->make(PlateformCode::class)->destroyCode());
    }

    public function recodePage()
    {
        return $this->success($this->app->make(PlateformCode::class)->recodePage());
    }
}
